from django.http import HttpResponse
from django.shortcuts import render
from 签到系统.models import Check_info
# Create your views here.
def show_qr(request):
    name = request.GET.get('name')
    uid = request.GET.get('uid')
    contex = {
        'name': name,
        'uid': uid,
        'url':f'http://127.0.0.1:8000/check_info?name={name}&uid={uid}',
    }
    return render(request,'qr_code.html', context=contex)

def index(request):
    return render(request,'index.html')

def check_info(request):
    name = request.GET.get('name')
    uid = request.GET.get('uid')
    check_info1 = Check_info.objects.create(name=name,uid=uid)
    check_info1.save()
    massage = f'{name}-{uid}签到成功!'
    return HttpResponse(massage)